Skip to content

Fix: Imutils freezes if file end reaches(Bug)#102

Merged
jrosebr1 merged 1 commit intoPyImageSearch:masterfrom
abhiTronix:master
Dec 2, 2018
Merged

Fix: Imutils freezes if file end reaches(Bug)#102
jrosebr1 merged 1 commit intoPyImageSearch:masterfrom
abhiTronix:master

Conversation

@abhiTronix
Copy link
Contributor

@abhiTronix abhiTronix commented Nov 26, 2018

Hello,
@jrosebr1 I encountered following bug in the latest PR #86:

Bug:

Imutils freezes indefinitely if file(source) end reaches(without throwing any error), since there no rule to handle this exception.

Fix:

After applying my fix, we can now check for File End and exit safely as follows:

from imutils.video import FileVideoStream
cam = FileVideoStream('/home/test.mp4').start()
while True: 
	frame = cam.read()
	if frame is None: #check for file end 
	      break  #safely breaks out if end reaches
cv2.destroyAllWindows()
cam.stop()

Thank you once again, Adrian :)

@abhiTronix abhiTronix changed the title Fix: Imutils freezes when file end reaches(Bug) Fix: Imutils freezes if file end reaches(Bug) Nov 26, 2018
@jrosebr1 jrosebr1 merged commit e4784ec into PyImageSearch:master Dec 2, 2018
@jrosebr1
Copy link
Contributor

jrosebr1 commented Dec 2, 2018

Thanks @abhiTronix! Merged.

jrosebr1 added a commit that referenced this pull request Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants